package com.appspot.widget.base;

import javax.servlet.http.HttpServlet;

import java.io.FileInputStream;
import java.util.Properties;

public class BaseServlet extends HttpServlet {

	private static final long serialVersionUID = -5118500822306941595L;
	
	protected static String _ADD = "add";
	
	protected static String _LIST = "list";
	
	protected static String _UPDATE = "update";
	
	protected static String _DELETE = "delete";
	

	protected boolean isOn() {
		boolean rs = true;
		Properties prop = new Properties();
		try {
			prop.load(new FileInputStream(this.getServletContext().getRealPath(
					"/WEB-INF/setting/global.properties")));
			if (prop.getProperty("switch").toLowerCase().equals("off"))
				rs = false;
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
		return rs;
	}

}
